<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="quan">quan</div>
    <script>
      // 1、赋值文本
      const copyToClipboard = (text) => {
        navigator.clipboard.writeText(text);
      };

      // 2、获取第几天
      const dayOfYear = (date) => {
        return Math.floor(
          (date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24
        );
      };

      const quan = document.querySelector("#quan");
      quan.addEventListener("click", () => {
        console.log(dayOfYear(new Date(2023, 4, 2)));
      });
    </script>
  </body>
</html>
